﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using UnityEngine.UI;

public class SelectPointItem : MonoBehaviour {

	public void AddButtonListener(Action selfPoint,Action mapPoit)
    {
        Button button = transform.Find("SelfPoint").GetComponent<Button>();
        button.onClick.RemoveAllListeners();
        button.onClick.AddListener(()=> {
            selfPoint();
            AutoDestroy();
        });

        button = transform.Find("MapPoint").GetComponent<Button>();
        button.onClick.RemoveAllListeners();
        button.onClick.AddListener(() => {
            mapPoit();
            AutoDestroy();
        });
    }

    private void AutoDestroy()
    {
        Destroy(gameObject);
    }
}
